<script type="text/javascript">

    // Function for reload Sub Departemen option, depend on selected Departemen

    $(document).ready(function() {
        // Setup Form
        $('#form_master').setupForm([
            { name: 'id_barang_masuk_pk', type: 'text', size: 'medium', maxlength: 10, noempty:true },
            { name: 'id_po_fk', type: 'text', size: 'small', maxlength: 10, noempty:true },
            { name: 'tgl_barang_masuk', type: 'date', size: 'small', maxlength: 10, noempty:true },
            { name: 'ket_barang_masuk', type: 'text', size: 'medium', maxlength: 10},

        ], 
            <?php echo json_encode($data); ?>
        );

        $('#ip').numberbox({
            min:0,
            precision:2
        });

        
        <?php if($mode=="edit"){ ?>
        $('#id_barang_masuk_pk').readonly();
        <?php } ?>
        
        // Set Action Button
        var buttons = [{ label: 'Save', icon: 'save', onclick: function() { 
                            $('#form_master').submitForm(   '/'+controller+'/ajax_post', 
                                {   
                                     onComplete : function(data){ eval('oData = '+data); loadPage('/'+controller+'/edit/?id_barang_masuk_pk='+(oData.genid!='' ? oData.genid : $('#id_barang_masuk_pk').getval())); }
                                } 
                            ); 
                        }},
                       { label: 'Close', icon: 'cancel', onclick: function() { 
                         loadPage('/'+controller+'/Index'); 
                    } }];
        setAction(buttons);
        
        // Create Tab
        $('#tt').tabs({ border:false });  
        
        // Focus at First Object
        $('#form_master').focusFirst();

        
    });
</script>

<div id="form_master_message" style="display:none;"></div>
<table class="tb_form" style="display:none; width:100%; " cellpadding="0" cellspacing="0" border="0">
    <tr>
        <td class="label">ID Barang Masuk</td>
        <td><input id="id_barang_masuk_pk" /></td>
    </tr>
    <tr>
        <td class="label">ID PO</td>
        <td><input id="id_po_fk" /></td>
    </tr>
    <tr>
        <td class="label">Tanggal Barang Masuk</td>
        <td><input id="tgl_barang_masuk" /></td>
    </tr>
    <tr>
        <td class="label">Keterangan</td>
        <td><input id="ket_barang_masuk" /></td>
    </tr>
</table>

<div id="tt" class="easyui-tabs" style="min-height:400px;"> 

    <div title="Detail Barang Masuk" style="overflow:auto;padding:10px;">  
        <?php if ($mode=="edit"): ?>
            <?php require_once('detail_barang_masuk.php'); ?>
        <?php else: ?>
            <center><h4>Lakukan Save terlebih dahulu untuk memasukkan data Pendidikan!!</h4></center>
        <?php endif ?>
    </div>


</div>